package com.example.experiment03.Controller;


import com.example.experiment03.Analysisservce.CodDataSearchService;
import com.example.experiment03.CODData.Coddata;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
public class CodDataController {
    @Autowired
    private CodDataSearchService codDataSearchService;

    @RequestMapping("/index.html")
    public ModelAndView ShowData(@RequestParam(name = "key", required = false) String key) {
        List<Coddata> coddataList = codDataSearchService.RunKey(key);
        System.out.println(coddataList);
        return new ModelAndView("index.html", "codList", coddataList);
    }
}

